package io.github.junxworks.qt.modules.tushare.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import io.github.junxworks.junx.core.executor.StandardThreadExecutor;

@Service("TushareComposeService")
public class TushareComposeService {

	@Autowired
	private TushareFinanceService financeService;

	@Autowired
	private TushareOtherDataService otherDataService;

	@Autowired
	private StandardThreadExecutor standardThreadExecutor;

	public void fetchComposedDataByPeriod(String period) {

		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchIncomeData(period); //利润表
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchCashflowData(period); //现金流量表
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchBalancesheetData(period); //资产负载表
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchFinaMainBzData(period); //主营业务表
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchFinaIndicatorData(period);//财务指标
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				financeService.fetchStockHolderNumber(period); //股东人数
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				otherDataService.fetchStockTop10Holders(period);//十大股东
			}
		});
		standardThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				otherDataService.fetchStockTop10Floatholders(period);//十大流通股东
			}
		});
	}
}
